home *** CD-ROM | disk | FTP | other *** search
/ Adventures with Oslo: Tools & Gadgets / Adventures with Oslo - Tools and Gadgets.ISO / mac / Ad / Mod04 / squares.Dir / 00031.ls < prev    next >
Encoding:
Text File  |  1994-09-23  |  1.4 KB  |  49 lines

  1. on startMovie
  2.   set HC to the number of cast "handCursor"
  3.   cursor([HC, HC + 1])
  4.   when mouseUp then checkLoc
  5. end
  6.  
  7. on checkLoc
  8.   if the clickOn <> 0 then
  9.     set horiz to the locH of sprite the clickOn
  10.     set vert to the locV of sprite the clickOn
  11.     if (constrainH(2, horiz) = horiz) and (constrainV(2, vert) = vert) then
  12.       if ((horiz < 146) and (vert < 205)) or ((horiz > 265) and (vert < 205)) or ((horiz < 146) and (vert > 324)) or ((horiz > 265) and (vert > 324)) then
  13.         nothing()
  14.       else
  15.         set snapH to (horiz - 106) / 40
  16.         set snapV to (vert - 165) / 40
  17.         if snapH > 4 then
  18.           set snapH to 4
  19.         end if
  20.         if snapV > 4 then
  21.           set snapV to 4
  22.         end if
  23.         set the locH of sprite the clickOn to 127 + (snapH * 40)
  24.         set the locV of sprite the clickOn to 186 + (snapV * 40)
  25.         updateStage()
  26.         checkForWinner()
  27.       end if
  28.     end if
  29.   end if
  30. end
  31.  
  32. on checkForWinner
  33.   set spriteNo to 3
  34.   set soFarSoGood to 1
  35.   repeat while (spriteNo < 24) and soFarSoGood
  36.     if the locH of sprite spriteNo <> word spriteNo - 2 of field "hLocs" then
  37.       set soFarSoGood to 0
  38.     end if
  39.     if the locV of sprite spriteNo <> word spriteNo - 2 of field "vLocs" then
  40.       set soFarSoGood to 0
  41.     end if
  42.     set spriteNo to spriteNo + 1
  43.   end repeat
  44.   if soFarSoGood then
  45.     puppetSound("Charge Fanfare.S")
  46.     go(the frame + 1)
  47.   end if
  48. end
  49.